<template>
  <div class="main_box"  style="padding:10px;">
    <div class="detail_wrap">
      <div class="tit">
        <h2> 反 馈 信 息 </h2>
        <el-button type="success" plain size="small" icon="fa fa-mail-forward" @click="returnList" > 返 回</el-button>
      </div>
        <div class="con">
            <ul>
              <li>
                <label class="label"> 封 面 </label>
                <el-image :src='dataInfo.coverImg' :preview-src-list="srcList" style="width: 100px; height: 100px"></el-image>
              </li>
            </ul>
            <ul>
              <li>
                <label class="label"> 书 名 </label>
                <span>{{dataInfo.bookName}}</span>
              </li>
            </ul>
            <ul>
              <li>
                <label class="label"> 作 者 </label>
                <span>{{dataInfo.author}}</span>
              </li>
            </ul>
            <ul>
              <li>
                <label class="label"> ISBN </label>
                <span>{{dataInfo.bookCode}}</span>
              </li>
            </ul>
            <ul>
              <li>
                <label class="label"> 出版社 </label>
                <span>{{dataInfo.press}}</span>
              </li>
            </ul>

          <div class="tit">
            <h2> 错误详情 </h2>
          </div>
          <ul>
            <li>
              <label class="label"> 错误图示 </label>
              <el-image :src='dataInfo.questionPageVos[0].pageImg' :preview-src-list="errsrcList" style="width: 100px; height: 100px"></el-image>
            </li>
          </ul>
          <ul>
            <li>
              <label class="label"> 页 数 </label>
              <span>{{dataInfo.questionPageVos[0].pages | pagesFilter }}</span>
            </li>
          </ul>

          <div class="tit">
            <h2>反 馈 问 题</h2>
          </div>
          <ul>
            <li>
              <label class="label"> 匿 名 </label>
              <span>{{dataInfo.questionInfo.anonymous | anonymousFilter}}</span>
            </li>
          </ul>
          <ul v-if="dataInfo.questionInfo.anonymous == 2">
            <li>
              <label class="label"> 反馈人 </label>
              <span>{{dataInfo.questionInfo.linkMan}}</span>
            </li>
          </ul>
          <ul v-if="dataInfo.questionInfo.anonymous == 2">
            <li>
              <label class="label"> 电 话 </label>
              <span>{{dataInfo.questionInfo.linkPhone}}</span>
            </li>
          </ul>
          <ul>
            <li>
              <label class="label"> 问题类型 </label>
              <span>{{dataInfo.questionInfo.questionType | questionTypeFilter}}</span>
            </li>
          </ul>
          <ul>
            <li>
              <label class="label"> 问题描叙 </label>
              <span>{{dataInfo.questionInfo.describes}}</span>
            </li>
          </ul>
          <ul>
              <li>
                  <label class="label"> 获取途径 </label>
                  <span>{{dataInfo.questionInfo.accessType | accessTypeFilter}}</span>
            </li>
          </ul>
          <ul>
            <li>
                <label class="label"> 具体途径 </label>
                <span>{{dataInfo.questionInfo.accessInfo }}</span>
            </li>
          </ul>
          <ul>
            <li>
                <label class="label"> 处理状态 </label>
                <span>{{dataInfo.questionInfo.questionState | questionStateFilter }}</span>
            </li>
          </ul>
          <ul>
            <li>
              <label class="label"> 反馈时间 </label>
              <span>{{dataInfo.questionInfo.createDate}}</span>
            </li>
          </ul>
          <ul>
            <li>
              <label class="label"> 备注 </label>
              <span>{{dataInfo.questionInfo.remark}}</span>
            </li>
          </ul>
        </div>
    </div>
  </div>
</template>

<script>
import FeedApi from "@/api/question/feedback";
export default {
  data () {
    return {
      dataInfo: "",
      srcList: [],
      errsrcList: [],
    };
  },
  mounted() {
    this.getData();
  },
  filters: {
    accessInfoFilter(value) {
      // 价格单位过滤器
      if(value == 1 ){
        return "书店地址";
      } else if(value == 2 ){
        return "购买链接";
      } else {
        return value;
      }
    },
    accessTypeFilter(value) {
      // 购买过滤器
      if(value == 1 ){
        return "线下书店";
      } else if(value == 2 ){
        return "线上购买";
      } else if(value == 3 ){
        return "校园提供";
      } else if(value == 10 ){
        return "其他";
      }
    },
    anonymousFilter(value) {
      // 是否匿名过滤器
      if(value == 1 ){
        return "是";
      } else if(value == 2 ){
        return "否";
      }
    },
    questionStateFilter(value) {
      // 审核状态过滤器
      if(value == 1 ){
        return "待审核";
      } else if(value == 5 ){
        return "已发邮件";
      } else if(value == 10 ){
        return "审核不通过";
      } else if(value == 15 ){
        return "取消反馈";
      } else if(value == 20 ){
        return "反馈成功";
      }
    },
    questionTypeFilter(value) {
      // 审核状态过滤器
      if(value == 1 ){
        return "美化国外";
      } else if(value == 2 ){
        return "编排不当";
      } else if(value == 3 ){
        return "有违公序良俗";
      } else if(value == 4 ){
        return "性暗示";
      } else if(value == 5 ){
        return "暴力倾向";
      } else if(value == 6 ){
        return "不良引诱";
      } else if(value == 7 ){
        return "画风怪异";
      } else if(value == 8 ){
        return "涉毒宣传";
      } else if(value == 9 ){
        return "恶意丑化";
      } else if(value == 10 ){
        return "辱国";
      } else if(value == 11 ){
        return "常识错误";
      } else if(value == 12 ){
        return "优质内容缺失";
      }
    },
    pagesFilter(val) {
      if( val == 90000 ){
          return '整书'
      }else if ( val == 90001 ) {
          return '封面'
      }else if ( val == 90002 ) {
          return '尾页'
      }else {
          return '第' + val + '页'
      }
    },
  },
  methods: {
    getData() {
      // 发送请求
      const that = this
      FeedApi.getQuestionBookInfo({
        questionId: this.$route.query.id
      }).then(res => {
        that.dataInfo = res.data;
        that.srcList = [res.data.coverImg];
        that.errsrcList = [res.data.questionPageVos[0].pageImg];
        console.table(that.errsrcList)
      });
    },
    returnList() {
      // 返回
      this.$store.dispatch('delView', this.$route);
      this.$router.push({ path: '/question/questionManagement'});
    },
  }
}
</script>

<style lang="scss" src="@/assets/css/views/Detail.scss" scope>
</style>
